'''
Created on Nov 19, 2010

@author: namikata
'''

import pygame
from pygame.locals import *
from gameobjects.vector2 import Vector2

LeftButton, CenterButton, RightButton = (0,1,2)

class Mouse(object):
    '''
    classdocs
    '''
        
    last_pressed = ()
    current_pressed = ()
    position = Vector2(0,0)
    delta = Vector2(0,0)
    wheel_up = 0
    wheel_down = 0
    
    def get_pressed(self,button):
        """0 = not pressed, 1 = pressed, 2 = hold """
        if self.current_pressed[button]:
            return int(self.current_pressed[button]) + int(self.last_pressed[button])
        else:
            return 0
      
    def update(self,buttons, position,delta, wheel_up, wheel_down):
        self.position = position
        self.delta = delta
        self.last_pressed = self.current_pressed
        self.current_pressed = buttons
        self.wheel_up = wheel_up
        self.wheel_down = wheel_down
        